<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<title></title>
	</head>
	<body>
		<script>
			//构造函数模式 
		//小明 今年18岁 性别男 有男朋友 男朋友会说话 
		function Person(name,age,gender,index,index2){
			this.name=name;
			this.age=age;
			this.gender=gender;
			this.index=index;
			this.index2=index2;
			this.index3=index3; 
		}
		function index3(){
				alert(this.name+"今年"+this.age+"岁,"+"性别:"+this.gender+this.index+this.index2+"，这一段就是男朋友说的")
		}
		var person=new Person("小明",18,"男","有男朋友","男朋友会说话");
		person.index3();
		
		
	
		//工厂模式
		//造一辆车 出厂 （合格证/建议零售价/说明书）
		 function Che(name,time,index,index1,index2){
		 	var Car=new Object();
		 	Car.name=name;
		 	Car.time=time;
		 	Car.index=index;
		 	Car.index1=index1;
		 	Car.index2=index2;
		 	Car.say=function(){
		 		alert(this.name+"出厂时间："+this.time+"合格证："+this.index+"建议零售价："+this.index1+"说明："+this.index2)
		 	}
		 	return Car;
		 }
		
		 var car=Che("奥迪A8L","2017.7.25","合格","123456","奥迪双钻,我的伙伴")
		 car.say()
		</script>
	</body>
</html>
